
USE [SSB]
GO

--- MESSAGE TYPE ---
CREATE MESSAGE TYPE [http://ssbrouter/v10/Types/SSBArticleMsg] 
AUTHORIZATION [dbo] VALIDATION = WELL_FORMED_XML
GO

CREATE MESSAGE TYPE [http://ssbrouter/v10/Types/SSBPublishMsg] 
AUTHORIZATION [dbo] VALIDATION = WELL_FORMED_XML
GO


CREATE MESSAGE TYPE [http://ssbrouter/v10/Types/SSBSubscribeMsg] 
AUTHORIZATION [dbo] VALIDATION = WELL_FORMED_XML
GO

--- CONTRACT ---

CREATE CONTRACT [http://ssbrouter/v10/SSBPublishContract] 
AUTHORIZATION [dbo] ([http://ssbrouter/v10/Types/SSBArticleMsg] SENT BY INITIATOR,
[http://ssbrouter/v10/Types/SSBPublishMsg] SENT BY INITIATOR)


GO
CREATE CONTRACT [http://ssbrouter/v10/SSBSubscribeContract] 
AUTHORIZATION [dbo] ([http://ssbrouter/v10/Types/SSBArticleMsg] SENT BY INITIATOR,
[http://ssbrouter/v10/Types/SSBSubscribeMsg] SENT BY INITIATOR)
GO

--- QUEUE ---
CREATE QUEUE [dbo].[http://ssbrouter/v10/FromQueue] WITH STATUS = ON , 
RETENTION = OFF
GO

--- SERVICE ----

--create service for web001 database
CREATE SERVICE [http://ssbrouter/v10/Web001/FromService]  
AUTHORIZATION [Web001Dbo]  
ON QUEUE [dbo].[http://ssbrouter/v10/FromQueue] 
([http://ssbrouter/v10/SSBPublishContract],
[http://ssbrouter/v10/SSBSubscribeContract])
GO

--create serviec for wms001 database
CREATE SERVICE [http://ssbrouter/v10/WMS001/FromService]  
AUTHORIZATION [WMS001Dbo]  
ON QUEUE [dbo].[http://ssbrouter/v10/FromQueue] 
([http://ssbrouter/v10/SSBPublishContract],
[http://ssbrouter/v10/SSBSubscribeContract])
GO


--- ROUTE ---

CREATE ROUTE [http://ssbrouter/v10/SSBPubSubRoute]   
AUTHORIZATION [dbo]   
WITH  SERVICE_NAME  = N'http://ssbrouter/v10/SSBPubSubService' 
,  ADDRESS  = N'TCP://SSBRouter:4050' 



--- REMOVE SERVICE BINDING ---

CREATE REMOTE SERVICE BINDING [http://ssbrouter/v10/SSBPubSubRSB]   
AUTHORIZATION [dbo]  
TO SERVICE N'http://ssbrouter/v10/SSBPubSubService'  
WITH USER = [SSBRouterDbo] ,  ANONYMOUS = OFF 
GO
